package org.xiaojl.modules.sys.entity;

import org.xiaojl.common.base.BaseEntity;
import org.xiaojl.utils.ToolUtil;

import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

/**
 * <p>
 * 系统日志表
 * </p>
 *
 * @author xiaojl
 * @since 2017-09-18
 */
@TableName("sys_log")
public class Log extends BaseEntity<Log> {

    private static final long serialVersionUID = 1L;

    /**
     * 登陆名
     */
	private String loginName;
	
    /**
     * 真实名
     */
	private String realName;
	
    /**
     * 内容
     */
	private String optContent;
	
    /**
     * 客户端ip
     */
	private String clientIp;
	
    /**
     * 执行结果
     */
	private String resultText;
	
    /**
     * 请求耗时
     */
	private Long requestTime;
	
    /**
     * 响应结果码
     */
	private String resultCode;

	@Override
	public Wrapper<Log> bindingQueryWrapper() {
		Wrapper<Log> wrapper = new EntityWrapper<Log>();
		if(ToolUtil.isNotEmpty(this.loginName)){
			wrapper.like("loginName", this.loginName);
		}
		if(ToolUtil.isNotEmpty(this.realName)){
			wrapper.like("realName", this.realName);
		}
		if(ToolUtil.isNotEmpty(this.optContent)){
			wrapper.like("optContent", this.optContent);
		}
		if(ToolUtil.isNotEmpty(this.clientIp)){
			wrapper.like("clientIp", this.clientIp);
		}
		if(ToolUtil.isNotEmpty(this.resultText)){
			wrapper.like("resultText", this.resultText);
		}
		if(ToolUtil.isNotEmpty(this.resultCode)){
			wrapper.like("resultCode", this.resultCode);
		}
		if(ToolUtil.isNotEmpty(this.createTimeStart)){
			wrapper.gt("createTime", this.createTimeStart);
		}
		if(ToolUtil.isNotEmpty(this.createTimeEnd)){
			wrapper.lt("createTime", this.createTimeEnd);
		}
		return wrapper;
	}


	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getOptContent() {
		return optContent;
	}

	public void setOptContent(String optContent) {
		this.optContent = optContent;
	}

	public String getClientIp() {
		return clientIp;
	}

	public void setClientIp(String clientIp) {
		this.clientIp = clientIp;
	}

	public String getResultText() {
		return resultText;
	}

	public void setResultText(String resultText) {
		this.resultText = resultText;
	}

	public Long getRequestTime() {
		return requestTime;
	}

	public void setRequestTime(Long requestTime) {
		this.requestTime = requestTime;
	}

	public String getResultCode() {
		return resultCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}


	@Override
	public String toString() {
		return "Log [ id=" + id 
				+ " loginName=" + loginName + ","
				+ " realName=" + realName + ","
				+ " optContent=" + optContent + ","
				+ " clientIp=" + clientIp + ","
				+ " resultText=" + resultText + ","
				+ " requestTime=" + requestTime + ","
				+ " resultCode=" + resultCode + ","
				+ " createBy=" + createBy + ", createTime=" + createTime
				+ ", delFlag=" + delFlag + ", createTimeStart="
				+ createTimeStart + ", createTimeEnd=" + createTimeEnd + "]";
	}

}
